How to Add Extra Fees in WooCommerce (Without a Plugin)

Extra Fees in WooCommerce

WooCommerce is a powerful eCommerce platform. If you are using WooCommerce to build your online store then sometimes you may need to charge extra fees for specific services such as handling fees, gift wrapping fees, or Cash on Delivery (COD) fees. This post will lead you through the process of adding extra charges in WooCommerce using PHP, rather than plugins.

Fast And Secure Hosting For WordPress

Experience lightning-fast speed, rock-solid security, and world-class support tailored for WordPress. Simply better hosting.

Tutorialswebsite

Adding Custom Fees Using WooCommerce Hooks

WooCommerce provides the woocommerce_cart_calculate_fees hook, allowing developers to apply extra fees dynamically.

Steps to Add a Fixed Fee in WooCommerce

  • Open your WordPress theme’s functions.php file.
  • Insert the following PHP snippet:
  • Save the file and check the checkout page for the additional fee.
Extra Fees in WooCommerce

Also Read: Track and Display ‘Add to Cart’ Button Click Counts in WooCommerce

Adding Extra Charges for Cash on Delivery (COD)

If you want to apply an additional fee when customers select Cash on Delivery (COD), use this modified function:

How It Works:

  • Checks the selected payment method.
  • If COD is selected, a 10 handling fee is applied.
  • The fee only appears when COD is chosen, keeping checkout fees dynamic.
WooCommerce cash on delivery extra fee

Suggested Read: Partial COD (Cash on Delivery) in WooCommerce

Adding Additional Fees Based on Payment Method and Cart Total

You may need to charge fees differently based on the selected payment method and the cart total. The following snippet handles that:

How It Works:

  • If COD is selected and the cart total is less than 250, a 10 fee is applied.
  • If PayPal is selected and the cart total exceeds 300, a 5 fee is added.
  • Ensures that fees are added dynamically based on cart conditions
Adding Additional Fees Based on Payment Method and Cart Total

Add Additional Charges using Plugins

If you prefer not to edit code, you can use a plugin to handle additional charges.

Recommended WooCommerce Fee Plugins:

Conclusion

Adding additional charges in WooCommerce can be done efficiently using PHP code or via a plugin. If you want more flexibility, coding offers dynamic control over when and how fees are applied. However, plugins provide a user-friendly way to manage extra costs without writing code.

Are you want to get implementation help, or modify or extend the functionality?

A Tutorialswebsite Expert can do it for you.

FAQs

Thanks for reading 🙏, I hope you found this tutorial helpful for your project. Keep learning! If you face any problems – I am here to solve your problems.

Related posts

2 Thoughts to “How to Add Extra Fees in WooCommerce (Without a Plugin)”

  1. […] Also Read: How to Add Extra Fees in WooCommerce (Without a Plugin) […]

  2. […] Recommended: How to Add Extra Fees in WooCommerce (Without a Plugin) […]

Comments are closed.